package com.tanhua.app.controller;

import com.tanhua.app.controllerservice.TaoHuaService;
import com.tanhua.domain.vo.SoundVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author ly
 * @date 2021/9/4 0004 14:11
 */
@RestController
@RequestMapping("/peachblossom")
public class TaoHuaController {

    @Autowired
    private TaoHuaService taoHuaService;

    @PostMapping(name = "桃花传音-发送语音")
    public ResponseEntity sendVoice(@RequestBody MultipartFile soundFile) throws IOException {
        taoHuaService.sendVoice(soundFile);
        return ResponseEntity.ok(null);
    }

    @GetMapping(name = "桃花传音-接受语音")
    public ResponseEntity acceptVoice(){
        SoundVo soundVo = taoHuaService.acceptVoice();
        return ResponseEntity.ok(soundVo);
    }
}
